import { createStore } from 'vuex'
import { CartNum } from '@/lib/ecapi'
interface state{
  cartNum:number
}
const state:state= {
  cartNum:0,
};
export default createStore({
  state,
  mutations: {
    /**
  * @description 存储查询到的购物车数量
  * @param {*} state
  * @param {*} accessToken
  */
    setcartNum(state:state,payload:number){
      state.cartNum=payload;
    }
  },
  actions: {
    async asyncCartNum({ commit }) {
        commit('setcartNum',await CartNum());
     },
  },
  modules: {
  }
})
